package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(11);not null"`
	Password string `gorm:"type:varchar(32);not null"`
}

func (u *User) FindUserByMobile(db *gorm.DB, mobile string) error {
	return db.Debug().Where("mobile = ?", mobile).FirstOrCreate(u).Error
}

func (u *User) FindUser(db *gorm.DB, mobile string) error {
	return db.Debug().Where("mobile = ?", mobile).First(u).Error
}
